import { Controller } from "@/controller";
import { decorator } from "@/tools/fns";
import { observer } from "mobx-react";
import { runtime } from 'dingtalk-jsapi';
import React from "react";
import * as apis from "@/apis";
import { CORP_ID_MAP } from "@/constants/corpIdMap";

const Login = decorator(observer)(() => {
    const controllers = Controller.instance;

    React.useEffect(() => {
        if (!controllers.company) return;
        runtime.permission.requestAuthCode({ corpId: CORP_ID_MAP[controllers.company] })
            .then(({ code }) => {
                return apis.user.login.post(code);
            }).then(data => {
                console.log(data)
            })
    }, [controllers.company])

    return <div>登录页面</div>;
})
export default Login;

